﻿
@{
    ViewData["Title"] = "List";
}

@section Scripts
    {
    <script type="text/javascript">
        // 自定义模块
        layui.config({
            base: '/design/lay/modules/',
            version: 'v1.2.3'
        }).extend({                         // 模块别名
            authtree: 'authtree'
        });

        var selfLayer = null, page = 1, active = null;
        layui.use(['form', 'layedit', 'authtree'], function () {
            var form = layui.form, authtree = layui.authtree;


            // 一般来说，权限数据是异步传递过来的
            $.ajax({
                url: '/Meun/GetMenuAll',
                dataType: 'json',
                success: function (data) {
                    var trees = authtree.listConvert(data.data.list, {
                        primaryKey: 'id'
                        , startPid: '0'
                        , parentKey: 'pid'
                        , nameKey: 'name'
                        , valueKey: 'id'
                        , checkedKey: data.data.checkedId
                    });

                    authtree.render('#LAY-auth-tree-index', trees, {
                        inputname: 'authids[]',
                        layfilter: 'lay-check-auth',
                        autowidth: true,
                    });

                }
            });

        });
    </script>
}

<form class="layui-form">
    <div class="layui-form-item">
        <label class="layui-form-label">权限菜单树</label>
        <div class="layui-input-block">
            <div id="LAY-auth-tree-index"></div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button asp-action="Add" class="layui-btn" style="width: 100px" lay-submit="" lay-filter="submit">新增</button>
        </div>
    </div>
</form>

